#ifndef SERVER_H
#define SERVER_H
 
#include <QObject>
#include <QAbstractSocket>
#include <QTcpServer>
class QTcpSocket;
class QFile;
 
class CServer : public QObject
{
    Q_OBJECT
 
public:
    explicit CServer();
    ~CServer();

protected:
	void run();
    
signals:
    void sigSvrStatus(int code, QString msg); //code: 1 status 2 process 3 error
 
public slots:
    void start();
    void acceptConnection();
    void updateServerProgress();
    void displayError(QAbstractSocket::SocketError socketError);
    void startBtnClicked();
 
private: 
    QTcpServer m_tcpServer;
    QTcpSocket *m_tcpServerConnection;
    qint64 m_totalBytes;
    qint64 m_bytesReceived;
    qint64 m_fileNameSize;
    QString m_fileName;
    QFile *m_localFile;
    QByteArray m_inBlock;
};
 
#endif // WIDGET_H
